//
//  YXYZoomImageModel.m
//  Topit
//
//  Created by dllo on 15/12/7.
//  Copyright © 2015年 YXY. All rights reserved.
//

#import "YXYZoomImageModel.h"

@implementation YXYZoomImageModel

- (id)valueForUndefinedKey:(NSString *)key {
    return nil;
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key {
    if ([key isEqualToString:@"albums"]) {
        NSArray *array = value;
        NSMutableArray *dataSource = [NSMutableArray arrayWithCapacity:0];
        for (NSDictionary *dic in array) {
            YXYZoomAlbumsModel *zoomAlbumsModle = [[YXYZoomAlbumsModel alloc] initWithDictionary:dic];
            [dataSource addObject:zoomAlbumsModle];
            [zoomAlbumsModle release];
        }
        self.albumsArray = [NSArray arrayWithArray:dataSource];
    }
    
    if ([key isEqualToString:@"related_items"]) {
        NSArray *array = value;
        NSMutableArray *dataSource = [NSMutableArray arrayWithCapacity:0];
        for (NSDictionary *dic in array) {
            YXYZoomRelatedModel *zoomRelatedModle = [[YXYZoomRelatedModel alloc] initWithDictionary:dic];
            [dataSource addObject:zoomRelatedModle];
            [zoomRelatedModle release];
        }
        self.relatedArray = [NSArray arrayWithArray:dataSource];
    }
}
@end
